Try 2 bias values when calling originalPositionFor from applySourceMap#376
Try 2 bias values when calling originalPositionFor from applySourceMap#376MotorHeat wants to merge 2 commits intomozilla:masterfrom
Conversation
Pull Request Test Coverage Report for Build 543
💛 - Coveralls |
|
I think this is a nice idea. I'm curious what others will think |
|
@jasonLaster @MotorHeat rather than trying both if (aBias == exports.LEAST_UPPER_BOUND) {
return aHigh < aHaystack.length ? aHigh : -1;
} else {
return mid;
}Where if Am I missing something, or would it be good to have a mode that's more resilient like this? |
Hi @MotorHeat @bcoe, thanks for the patch. I'm trying to revive the maintenance of this package.... |
The method applySourceMap is calling originalPositionFor without providing the
biasvalue.By default
biasequals to GREATEST_LOWER_BOUND which means: if exact column value was not found - take nearest item from the left. In some cases there is "no nearest value on the left" because most correct value is nearest "from the right". I believe it is worth to try to calloriginalPositionForwith both available bias values rather then just try one and claim that we cannot find mapping while it is exists.Initially the GREATEST_LOWER_BOUND value is used (like it was before). If
originalPositionForcannot find relevant mapping then LEAST_UPPER_BOUND bias value is used to search again.I don't think that
applySourceMapshould made any assumptions on the structure of the source maps and it should be symmetric as much as possible (in proposed implementation preference is given to the "left" element but this is how it always was before).